#ifndef __ZENGL_ALLOCATOR__
#define __ZENGL_ALLOCATOR__

#include <stdlib.h>

#include "api.hpp"

namespace zen {

	namespace gl {


		typedef void* (*ZGLALLOCATORMETHOD)(size_t size);
		typedef void (*ZGLDEALLOCATORMETHOD)(void* ptr);

		/**
		* Used by zengl to allocate memory, used to store streams from files or buffering opengl results,
		* it's implementation can be set with zglSetAllocator.
		*/
		void* zglAllocate(size_t size);

		/**
		* Used by zengl to deallocate memory, allo pointers allocated by zengl methods must be deallocated with
		* this method.
		*/
		void zglDeallocate(void* ptr);
		
		/**
		* Set the allocator and deallocator methods to be used by zengl, the parameters can be set to nullptr to unset
		* the allocator and deallocator, by default they are null and zengl uses the malloc and free.
		* If used, this method must be called before any other zengl methods.
		* param allocator: must be a pointer to a method of the same signature as the standard malloc.
		* param deallocator: must be a pointer to a method of the same signature as the standard free.
		*/
		void zglSetAllocator(ZGLALLOCATORMETHOD allocator, ZGLDEALLOCATORMETHOD deallocator);


	} // namespace gl

} // namespace zen

#endif // __ZENGL_ALLOCATOR__